<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <title>06.列表渲染</title>
  </head>
  <body>
    <div id="root"></div>

    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.js"></script>

    <script type="text/babel">
      const persons = [
        { id: 1, name: "小狗" },
        { id: 2, name: "小猫" },
        { id: 3, name: "小猪" },
      ];

      const element = (
        <ul>
          {persons.map((person, index) => {
            return <li key={person.id}>{person.name}</li>;
          })}
        </ul>
      );

      ReactDOM.createRoot(document.getElementById("root")).render(element);
    </script>
  </body>
</html>
